import { createRouter, createWebHistory } from 'vue-router'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      redirect: '/operation/auth/login',
    },
    // 认证
    {
      path: '/operation/auth',
      name: 'operation-auth',
      redirect: '/operation',
      children: [
        {
          path: 'login',
          name: 'operation-login',
          component: () => import('../views/operation/auth/LoginView.vue'),
        },
      ],
    },
    // 运营管理系统主路由
    {
      path: '/operation',
      name: 'operation',
      component: () => import('../views/operation/MainView.vue'),
      redirect: '/operation/dashboard',
      children: [
        // 首页
        {
          path: 'dashboard',
          name: 'operation-dashboard',
          component: () => import('../views/operation/DashboardView.vue'),
          meta: { title: '首页', icon: 'HomeFilled' },
        },
        // 用户管理
        {
          path: 'system/user',
          name: 'system-user',
          component: () => import('../views/operation/system/UserView.vue'),
          meta: { title: '用户管理', icon: 'User' },
        },
        // 角色管理
        {
          path: 'system/role',
          name: 'system-role',
          component: () => import('../views/operation/system/RoleView.vue'),
          meta: { title: '角色管理', icon: 'Connection' },
        },
      ],
    },
  ],
})

export default router
